﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace X23.Util.ContextUtil
{
    public static class ContextUtil
    {
        public static readonly AsyncLocal<UserContext> UserAsyncLocal = new AsyncLocal<UserContext>();

        public static UserContext CurrentUser
        {
            get => UserAsyncLocal.Value ?? new UserContext { Id = 0, Name = "未登录用户" };
        }
    }
    public class UserContext
    {
        public int Id { get; set; }
        public string Name { get; set; }
    }
}
